# Contributor: Jesse Young <jlyo@jlyo.org>
# Maintainer: Stuart Cardall <developer@it-offshore.co.uk>
pkgname=ucspi-tcp6
pkgver=1.05
pkgrel=0
pkgdesc="IPv6 enabled ucspi-tcp superserver"
url="http://www.fehcom.de/ipnet/ucspi-tcp6.html"
arch="all"
license="Public-Domain"
depends=""
depends_dev=""
makedepends="$depends_dev"
subpackages="$pkgname-doc"
conflicts="ucspi-tcp"
provides="ucspi-tcp"
source="https://www.fehcom.de/ipnet/$pkgname/$pkgname-$pkgver.tgz"
builddir="$srcdir"/host/$pkgname-${pkgver%%[a-zA-Z]}

build() {
       cd "$builddir"

       echo "${CC:-"gcc"} $CFLAGS" > conf-cc
       echo "${CC:-"gcc"} $LDFLAGS" > conf-ld
       echo "/usr" > src/home

       make -C src || return 1
}

package() {
       local f
       cd "$builddir"
       mkdir -p "$pkgdir"/usr/bin
       for f in $(cat package/commands-base); do
               cp "src/$f" "$pkgdir/usr/bin/$f"
       done

       for f in $(cd man && echo *.[0-9] ); do
               mkdir -p "$pkgdir/usr/share/man/man${f##*[a-zA-Z.]}"
               cp "man/$f" "$pkgdir/usr/share/man/man${f##*[a-zA-Z.]}/$f"
       done
       mkdir -p "$pkgdir/usr/share/licenses/$pkgname"
       cp doc/LICENSE "$pkgdir/usr/share/licenses/$pkgname/LICENSE"
}

sha512sums="eb17f9bd9d94c8f0bd379ae7bba09130e493d2302a738550cdc593a138adc80a2c4f1407a65c3d66a22e363c72c9a95f9435cf8ba5e4de4e5d3b520a9612ec97  ucspi-tcp6-1.05.tgz"
